#ifndef __LABOR_FILESYSTEM_H__
#define __LABOR_FILESYSTEM_H__

#include "../LaborCoreInclude.h"
#include "../Mem/stl_dllalloc.h"
#include "LaborFileEnum.h"
#include "LaborBaseObject.h"
#include "LaborLogger.h"
#include <vector>
NAMESPACE_LABOR3D_BEGIN


class LABORCORE_API  xFileSystem
{
	xFileSystem(){};
public:

public:
	std::ds_wstring        getFileName(const wchar_t* fullName);
	std::ds_wstring        getPathName(const wchar_t* fullName);
	const wchar_t*         getFileExtName(const wchar_t* filename );
	int                    loadFile( xint8_u*& fileBufer , const wchar_t* fileName);
	void                   unloadFile( xint8_u*& fileBufer);
	bool                   fileExist(const wchar_t* filename);
	bool                   loadFile(const wchar_t* fileName , std::ifstream& stream , std::ios::open_mode _mode  = std::ios::in | std::ios::binary );
	bool                   openFile(const wchar_t* fileName , std::fstream& stream , std::ios::open_mode _mode  =  std::ios::binary);
    static xFileSystem*    singleton();
    template <typename T>  void    fileNameWithoutExt(const wchar_t* name , T& out)
    {
        for(size_t i = 0 ; i < wcslen(name) ; i ++)
        {
            if(name[i] == '.') break;
            out.push_back( name[i] );
        }
    }

    template <typename T>void   fileNameWithoutExt(const char* name , T& out)
    {
        for(size_t i = 0 ; i < strlen(name) ; i ++)
        {
            if(name[i] == '.') break;
            out.push_back( name[i] );
        }
    }

};

NAMESPACE_LABOR3D_END

#endif
